use dta/FivaSmithJune2019.dta, clear

gen bloc="Other"
replace bloc="Labor" if party=="s"
replace bloc="Labor" if party=="dna"
replace bloc="Labor" if party=="nsa"
replace bloc="Labor" if party=="nkp"

replace bloc="Liberals" if party=="v"
replace bloc="Liberals" if party=="v_a"
replace bloc="Liberals" if party=="a"
replace bloc="Liberals" if party=="v"
replace bloc="Liberals" if party=="rf" 

replace bloc="Conservatives" if party=="h_fv"
replace bloc="Conservatives" if party=="fv"
replace bloc="Conservatives" if party=="h"

tab party if bloc=="Other" & year<1950

*************************************************************************************
****************** OVERALL: Vote-shares and Seat-shares Across Blocs 1909-1927*******
*************************************************************************************
keep if year>1906 & year<1930 /* fiva-hix sample */
replace votes=votes1 if year<1920 /* using first round votes for measuring party level support pre-reform */
collapse (sum) votes elected, by(bloc year)  /* this gives national level number of votes per party by election year */
egen nationalvotes=sum(votes), by(year)
egen nationalseats=sum(elected), by(year)

gen voteshare=votes/nationalvotes
gen seatshare=elected/nationalseat

keep if year<1950

foreach bloc in Labor Liberals Conservatives Other {
twoway (scatter voteshare year if bloc=="`bloc'", connect(l) lpattern(dash) msymbol(circle) mcolor(white) mlcolor(black)) (scatter seatshare year if bloc=="`bloc'", connect(l) msymbol(circle) mcolor(black)) ///
, xline(1919.5, lpattern(dash)) xtitle("") ytitle("") title(`bloc') plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) scheme(s1mono)  yscale(range(0 0.65)) ylabel(0[0.1]0.6) ylabel(, grid angle(0))  legend(order(1 "Vote-shares" 2 "Seat-shares")) xscale(range(1909 1927)) xlabel(1909[3]1927)
graph save figures/gph/vsh_sh_`bloc'.gph, replace
}
cd figures/gph
grc1leg vsh_sh_Labor.gph vsh_sh_Liberals.gph vsh_sh_Conservatives.gph vsh_sh_Other.gph , plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) scheme(s1mono)  
graph export ../FigureA1.pdf, replace
cd ../../
